package ferus.tigris.lines.personages;

public class SelfKillerBehavior extends BehaviorDelegate {

	private boolean die = false;
	private int elWidth = 0;
	private int speed = 15;

	public SelfKillerBehavior(BehaviorDelegate b) {
		super(b);
	}
	
	public void onUpdate() {
		elWidth -= speed ;
		if(elWidth <= 0)
			die = true;
		rootParent().setViewSize(elWidth);
	}

	public boolean dead() {
		return die ;
	}

	public void onSetViewSize(int elWidth) {
		if((this.elWidth == 0)&&!die)this.elWidth = elWidth; 
	}

}
